<?php
$lockDir = dirname(__DIR__) . '/../install/';

$lockFiles = [
    'first' => $lockDir . 'first.lock',
    'second' => $lockDir . 'second.lock', 
    'third' => $lockDir . 'third.lock',
    'fourth' => $lockDir . 'fourth.lock'
];

$targetStep = 'first.php';

if (file_exists($lockFiles['first'])) {
    $targetStep = 'second.php';
}
if (file_exists($lockFiles['second'])) {
    $targetStep = 'third.php';
}
if (file_exists($lockFiles['third'])) {
    $targetStep = 'fourth.php';
}
if (file_exists($lockFiles['fourth'])) {
    $targetStep = 'complete.php';
}

header("Location: $targetStep");
exit;
?>